home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / excel / we0146.exe / WE0146T.TXT
Text File  |  1991-10-18  |  28KB  |  678 lines

  1. ======================================================================
  2.     Microsoft Product Support Services Application Note (Text File)
  3.                 WE0146: MOST FREQUENTLY ASKED QUESTIONS
  4. ======================================================================
  5.                                                    Revision Date:10/91
  6.                                                       No Disk Included
  7.  
  8. The following information applies to Microsoft Excel for Windows
  9. version 3.0
  10.  
  11.  --------------------------------------------------------------------
  12. | INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
  13. | ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
  14. | Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
  15. | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
  16. | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
  17. | PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
  18. | accuracy and the use of this Application Note. This Application    |
  19. | Note may be copied and distributed subject to the following        |
  20. | conditions: 1) All text must be copied without modification and    |
  21. | all pages must be included; 2) If software is included, all files  |
  22. | on the disk(s) must be copied without modification [the MS-DOS(R)  |
  23. | utility DISKCOPY is appropriate for this purpose]; 3) All          |
  24. | components of this Application Note must be distributed together;  |
  25. | and 4) This Application Note may not be distributed for profit.    |
  26. |                                                                    |
  27. | Copyright 1991 Microsoft Corporation. All Rights Reserved.         |
  28. | Microsoft, MS-DOS, and the Microsoft logo are registered           |
  29. | trademarks and Windows is a trademark of Microsoft Corporation.    |
  30.  --------------------------------------------------------------------
  31.  
  32.                                    
  33.                     IMPORTING/EXPORTING TEXT FILES
  34.                     ==============================
  35.  
  36. ----------------------------------------------------------------------
  37. QUESTION: How can I import text files from a third-party application
  38.           into Excel? For example, I have some text files that I have
  39.           downloaded from my company's mainframe system, and I would
  40.           like to bring these into Excel 3.0. How can I do this?
  41.  
  42. ANSWER: If you are importing a text file from a third-party
  43. application into Excel, it is usually necessary to convert the file
  44. into a format that Excel can use. This involves parsing the data so
  45. that each field in each row appears in its own cell on the Excel
  46. worksheet. Each field in each record must be separated from the next
  47. by a "delimiter" -- a character that marks the end of one unit of data
  48. and the beginning of another. Excel uses this delimiter to parse the
  49. data.
  50.  
  51. There are three different ways to bring text files into Excel,
  52. depending on the type of delimiter used in the text file:
  53.  
  54. 1. If the file has a column delimiter that is either a tab or a comma,
  55.    the file can be opened by choosing Open from the File menu. From
  56.    the File Open dialog box, select the filename from the list of
  57.    files, or type in the filename, and choose the Text button. From
  58.    the Column Delimiter box, choose Tab or Comma, as appropriate for
  59.    your file, and choose OK.
  60.  
  61. 2. Another quick way to import a tab- or comma-delimited file into
  62.    Excel is to name the file with a .TXT extension (if tab delimited)
  63.    or a .CSV extension (if comma delimited). Excel will recognize the
  64.    format from the file extension and open it accordingly.
  65.  
  66. 3. If the file has a column delimiter other than a tab or a comma, the
  67.    file can be brought into Excel as a text file (it will open this
  68.    way if opened normally in Excel) and then parsed using the Excel
  69.    3.0 add-in macro FLATFILE.XLA. To use FLATFILE.XLA, do the
  70.    following:
  71.    
  72.    a. From the File menu, choose Open. Select FLATFILE.XLA from the
  73.       LIBRARY directory located in your Excel directory.
  74.    
  75.    b. Open your text file. Highlight column A, and from the Data menu,
  76.       choose Smart Parse (the Smart Parse command will be available
  77.       only if you have opened FLATFILE.XLA).
  78.    
  79.    c. If columns in your text file are delimited by a space or spaces,
  80.       choose the Blank Space ( ) option. If the delimiter is a forward
  81.       slash, choose the Slash (/) option. If the delimiter is some
  82.       other character, choose Other and type in the character. If the
  83.       file is a flat file (a file that uses spaces between the columns
  84.       to delimit the file), there may be extra spaces between the
  85.       fields in the file. If you would like to remove the spaces,
  86.       select Remove Extra Blank Spaces. When you choose OK, each field
  87.       in each row will be parsed out to its own cell.
  88.  
  89. For more information on opening files in Excel, see pages 338-340 of
  90. the "Microsoft Excel User's Guide."
  91.  
  92. For more information on the FLATFILE.XLA add-in macro, see pages 683-
  93. 684 in Appendix B of the "Microsoft Excel User's Guide."
  94.  
  95.  
  96. ----------------------------------------------------------------------
  97. QUESTION: I created a worksheet in Excel 3.0 and now need to export
  98.           this file from Excel to my mainframe. How can I do this?
  99.  
  100. ANSWER: Just as Excel can read in text files, it can also save
  101. worksheet files in text format. If you prefer a tab- or comma-
  102. delimited file, save the file by choosing Save As from the File menu;
  103. choose Options, and from the File Format box, select either Text
  104. format for a tab-delimited file or CSV for a comma-delimited file.
  105.  
  106. If you want to save the file as a flat file (a file that uses spaces
  107. between the columns to delimit the file), you can use the FLATFILE.XLA
  108. add-in macro:
  109.  
  110. 1. From the File menu, choose Open. Select FLATFILE.XLA from the
  111.    LIBRARY directory located in your Excel directory.
  112.  
  113. 2. Highlight the area of the worksheet that you want to save to a flat
  114.    file format.
  115.  
  116. 3. From the Data menu, choose Export (this command will only be
  117.    available if FLATFILE.XLA is open). The add-in macro will prompt
  118.    you for a filename. Type in a filename and choose Export. This file
  119.    can now be imported into any application that requires an ASCII
  120.    flat file.
  121.  
  122. For more information on saving files from Excel, see pages 135-143 of
  123. the "Microsoft Excel User's Guide."
  124.  
  125. For more information on the FLATFILE.XLA add-in macro, see pages 683-
  126. 684 in Appendix B of the "Microsoft Excel User's Guide."
  127.  
  128.                                    
  129.                  TRANSFERRING DATA FROM AN EXCEL MACRO
  130.                  =====================================
  131.  
  132. ----------------------------------------------------------------------
  133. QUESTION: I have written an Excel macro that prompts the user for
  134.           input and manipulates the information. However, the
  135.           information is not being returned to the worksheet. What am
  136.           I doing wrong?
  137.  
  138. ANSWER: One of the common misconceptions about Excel macros is the way
  139. that data is transferred to a spreadsheet. Each function in a macro
  140. returns a value to the cell in which the formula was entered. The
  141. result of that function is not placed in the worksheet without using a
  142. function to specifically do so. The FORMULA function is the function
  143. that should be used for entering data into a cell from a command
  144. macro.
  145.  
  146. The FORMULA function is one of the most important macro functions. It
  147. is the equivalent of typing data into a cell and pressing enter. The
  148. syntax of the function is:
  149.                                    
  150.    FORMULA(<formula_text>,<reference>)
  151.  
  152. The content, <formula_text>, whether it be a value or a reference to a
  153. value, will be placed in <reference>. If <reference> is omitted, the
  154. value will be placed in the active cell.
  155.  
  156. The following example uses the FORMULA function to enter the value
  157. returned from an INPUT function into cell A1 of SHEET1.XLS. The INPUT
  158. function prompts the user to enter a number.
  159.  
  160.               A
  161.    1 Example of FORMULA()
  162.    2 =INPUT("Please Enter a Number",1)
  163.    3 =FORMULA(A2,SHEET1.XLS!$A$1)
  164.    4 =RETURN()
  165.  
  166. If we assume that the user entered the number 987654321, cell A1 of
  167. SHEET1.XLS will contain that number after the macro is run.
  168.  
  169. For more information on the FORMULA function, see pages 89-90 of the
  170. "Microsoft Excel Function Reference."
  171.  
  172.                                    
  173.            USING OFFSET TO REFERENCE CELLS IN AN EXCEL MACRO
  174.            =================================================
  175.  
  176. ----------------------------------------------------------------------
  177. QUESTION: I am trying to speed up the execution of my macros, and I
  178.           understand that moving the active cell takes up time
  179.           unnecessarily. How can I refer to cells within a macro 
  180.           without moving the active cell? Generally, I select another 
  181.           cell that is a certain number of cells to the right or 
  182.           below the active cell.
  183.  
  184. ANSWER: The OFFSET function provides the functionality that you have
  185. described. The OFFSET function returns the reference of a cell or the
  186. contents of that cell offset a specified number of rows and columns
  187. from a reference. This allows you to obtain or retrieve information
  188. from a cell without selecting it first.
  189.  
  190. The syntax of the function is:
  191.  
  192.    OFFSET(<reference>,<rows>,<cols>,<height>,<width>)
  193.    
  194. The function returns a reference of a specified <height> and <width>,
  195. offset from another <reference> by a specified number of <rows> and
  196. <columns>.
  197.  
  198. The following examples both place the numbers 1 through 100 into cells
  199. A1:A100 on the active sheet. The first macro moves the active cell
  200. using the SELECT function. The second macro does not move the active
  201. cell and is thus faster.
  202.  
  203.             A                           B
  204.    1 First Macro                Second Macro
  205.    2 =SELECT(!A1)               =FOR("i",1,100)
  206.    3 =FOR("i",1,100)            =FORMULA(i,OFFSET(!A1,i-1,0))
  207.    4 =FORMULA(i,ACTIVE.CELL())  =NEXT
  208.    5 =SELECT("R[1]C")           =RETURN()
  209.    6 =NEXT()
  210.    7 =RETURN()
  211.  
  212. For more information on the OFFSET function, refer to pages 163-164 of
  213. the "Microsoft Excel Function Reference."
  214.  
  215.                                    
  216.  USING SELECT TO DUPLICATE COMMON KEYSTROKE COMMANDS IN AN EXCEL MACRO
  217.  =====================================================================
  218.  
  219. ----------------------------------------------------------------------
  220. QUESTION: I want to record a macro that contains the keystroke
  221.           SHIFT+CTRL+DOWN ARROW, which selects everything from the
  222.           position of the active cell to the bottom of the column of
  223.           data where the active cell is at the time. However, what the
  224.           recorder actually records is the fact that I selected, say,
  225.           cells A1 through A12, so that even if the size of my column
  226.           of data changes, the size and position of the selection do
  227.           not. What am I doing wrong?
  228.  
  229. ANSWER: The Macro Recorder in Excel does record SHIFT+CTRL+<arrow key>
  230. as a static SELECT statement. These SELECT statements will not have
  231. the same effect as the keystrokes when applied to blocks of data that
  232. may move or vary in size. The only workaround is to edit the macro to
  233. contain code that duplicates the effect of the keystroke.
  234.  
  235. The following macro duplicates SHIFT+CTRL+DOWN ARROW:
  236.  
  237.             A
  238.    1 Select_Macro
  239.    2 =SET.NAME("Top_Cell",ACTIVE.CELL())
  240.    3 =SELECT.END(4)
  241.    4 =SELECT(Top_Cell:ACTIVE.CELL(),Top_Cell)
  242.    5 =RETURN()
  243.                                   
  244. The codes to perform SHIFT+CTRL+UP ARROW, LEFT ARROW, or RIGHT ARROW
  245. operations are substantially similar; the only thing that must be
  246. changed is the number in the SELECT.END statement. The following are
  247. the numbers that can be used with SELECT.END:
  248.  
  249.    Parameter  Direction
  250.    ---------  ---------
  251.   
  252.     1         Left
  253.     2         Right
  254.     3         Up
  255.     4         Down
  256.  
  257. The following macro code duplicates SHIFT+CTRL+END:
  258.  
  259.             A
  260.    1 Select_Macro
  261.    2 =SET.NAME("Top_Cell",ACTIVE.CELL())
  262.    3 =SELECT.LAST.CELL()
  263.    4 =SELECT(Top_Cell:ACTIVE.CELL()Top_Cell)
  264.    5 =RETURN()
  265.  
  266. The following macro duplicates SHIFT+CTRL+HOME:
  267.  
  268.             A
  269.    1 Select_Macro
  270.    2 =SELECT(TEXTREF("!R1C1"):ACTIVE.CELL(),ACTIVE.CELL())
  271.    3 =RETURN()
  272.                                    
  273. For more information, see the SELECT statement section on pages 209-
  274. 213 of the "Microsoft Excel Function Reference."
  275.  
  276.                                    
  277.             USING SUM AND IF TO CREATE CONDITIONAL FORMULAS
  278.             ===============================================
  279.  
  280. ----------------------------------------------------------------------
  281. QUESTION: I would like to count the number of times that a particular
  282.           entry occurs in a range of cells. Is there a formula for
  283.           doing this?
  284.  
  285. ANSWER: By using  the SUM function and a conditional statement entered
  286. as an array, you can count all occurrences of a given value or text
  287. string. For example, how many times does the string "abc" occur in
  288. cells A1:B5?
  289.  
  290.       A     B            C
  291.    1 abc   123   {=SUM((A1:B5="abc")*1)}
  292.    2 xyz   456
  293.    3 777   aaa
  294.    4 987   abc
  295.    5 abc   hello
  296.  
  297. The formula in cell C1 is an array formula so it is typed in as it
  298. appears above WITHOUT the braces ({}), and then entered into the cell
  299. by pressing CTRL+SHIFT+ENTER. The result of this formula is 3.
  300.  
  301.  
  302. ----------------------------------------------------------------------
  303. QUESTION: I would like to evaluate all the cells in a range on my
  304.           worksheet, and if the value of the cell is 4, I would like
  305.           to add 4 to the total in the cell. Is there a formula that
  306.           can do this?
  307.  
  308. ANSWER: Using the SUM function, you can create a formula to total all
  309. the cells in a range that contain the number 4.
  310.  
  311.      A      B     C           D
  312.    1 abc   123   111   {=SUM((A1:C4=4)*4)}
  313.    2 xyz   456   4
  314.    3 777   4     4
  315.    4 4     abc   hello
  316.  
  317. The formula in cell D1 is an array formula so it is typed in as it
  318. appears above WITHOUT the braces ({}), and then entered into the cell
  319. by pressing CTRL+SHIFT+ENTER. The result of this formula is 16.
  320.  
  321.  
  322. ----------------------------------------------------------------------
  323. QUESTION: I have two columns of data. The first column consists of
  324.           numbers ranging from 1 to 3. The second column contains
  325.           values for each entry in the first column. I would like to
  326.           create a formula that will total all the entries in the
  327.           second column where a "1" appears in the first column.
  328.  
  329. ANSWER: Assuming the following data, you can use the SUM and IF
  330. functions to total all the entries in column B where a "1" appears in
  331. column A.
  332.  
  333.      A     B              C
  334.    1 1    10   {=SUM(IF(A1:A6=1,B1:B6,0))}
  335.    2 2    20
  336.    3 1    30
  337.    4 1    40
  338.    5 3    50
  339.    6 1    60
  340.  
  341. The formula in cell C1 is an array formula so it is typed in as it
  342. appears above WITHOUT the braces ({}), and then entered into the cell
  343. by pressing CTRL+SHIFT+ENTER. The result of this formula is 140.
  344.  
  345.   Note: In the above example, the ranges must be the same length, or
  346.   you may get an #N/A error.
  347.  
  348.                                    
  349.                   LOOPING STRUCTURES IN EXCEL MACROS
  350.                   ==================================
  351.  
  352. ----------------------------------------------------------------------
  353. QUESTION: When writing an Excel macro, because I execute the same
  354.           commands over and over, I find that the macro is getting
  355.           rather long. Is there a way that I can streamline the macro?
  356.  
  357. ANSWER: Excel has several functions that enable you to create looping
  358. structures similar to those found in many programming languages. Loops
  359. enable a macro to repeat a set of commands a number of times. Excel
  360. has three looping functions: FOR, FOR.CELL, and WHILE.
  361.  
  362. The FOR loop is used when you want to execute a set of commands a
  363. fixed number of times that is determined prior to entering the loop.
  364.  
  365.   FOR(<counter_text>,<start_num>,<end_num>,<step_num>)
  366.  
  367. For example, the following FOR-NEXT loop will execute five times and
  368. will shade every fifth cell in a column, starting with the currently
  369. selected cell:
  370.  
  371.             A
  372.    1 For_Next_Macro
  373.    2 =FOR("counter",1,5,1)
  374.    3 =BORDER(FALSE,FALSE,FALSE,FALSE,FALSE,TRUE)
  375.    4 =SELECT("R(5)C")
  376.    5 =NEXT()
  377.    6 =RETURN()
  378.  
  379. The FOR.CELL loop is used when you want to perform a set of commands
  380. on every cell in a specified range.
  381.  
  382.    FOR.CELL(<ref_name>,<area_ref>,<skip_blanks>)
  383.  
  384. The <ref_name> argument can be used within the loop to refer to the
  385. current cell being evaluated in the FOR.CELL loop. If a reference is
  386. not specified in the second argument, <area_ref>, the FOR.CELL loop
  387. will be executed on the currently selected range of cells.
  388.  
  389. The following FOR.CELL-NEXT loop will multiply each value in cells
  390. A1:D10 by 100 (cells A1:D10 are located on the active worksheet):
  391.  
  392.             A
  393.    1 For.Cell_Next_Macro
  394.    2 =FOR.CELL("current",!A1:!D10,TRUE)
  395.    3 =FORMULA(current*100,current)
  396.    4 =NEXT()
  397.    5 =RETURN()
  398.  
  399. The WHILE looping function will perform a set of commands as long as a
  400. certain condition is met.
  401.  
  402.    WHILE(<logical_test>)
  403.  
  404. Each time the WHILE function executes, it will evaluate the logical
  405. test to see if it is TRUE. If it is TRUE, the commands in the loop
  406. will execute. If it is FALSE, the macro will drop out of the WHILE
  407. loop.
  408.  
  409. In the following example, the WHILE loop will continue to execute down
  410. a column of cells until the active cell is blank. This method is
  411. useful if there is an undetermined number of entries in a row or
  412. column and you would like the WHILE loop to continue until there are
  413. no more entries. If the active cell contains the letter "A", the entry
  414. will be replaced with the word "Excellent".
  415.  
  416.             A
  417.    1 While_Next_Macro
  418.    2 =WHILE(NOT(ISBLANK(ACTIVE.CELL())))
  419.    3 =IF(ACTIVE.CELL()="A",FORMULA("Excellent"ACTIVE.CELL()))
  420.    4 =SELECT("R(1)C")
  421.    5 =NEXT()
  422.    6 =RETURN()
  423.  
  424. If you review the preceding examples, you will notice that each
  425. looping structure ends with a NEXT function. The NEXT function tells
  426. Excel where to return to the previous FOR, FOR.CELL, or WHILE
  427. statement. The NEXT function is required when using any of these
  428. statements.
  429.  
  430. You can exit from the middle of any loop by using the BREAK function.
  431.  
  432. If speed is a consideration, a FOR loop or a FOR.CELL loop should be
  433. used in place of a WHILE loop whenever possible. The WHILE loop tends
  434. to be slightly slower than the other two because Excel must evaluate
  435. the conditional statement each time it executes.
  436.  
  437. For examples and more in-depth coverage of each of the looping
  438. functions, see pages 602-605 of the "Microsoft Excel User's Guide."
  439.  
  440.                                    
  441.          CREATING DDE LINKS BETWEEN EXCEL AND WORD FOR WINDOWS
  442.          =====================================================
  443.  
  444. ----------------------------------------------------------------------
  445. QUESTION: I have a chart on my Excel worksheet, and I want to paste
  446.           link the chart into Word for Windows so that if I change the
  447.           chart, the picture of it in Word for Windows changes as
  448.           well. How can I do this?
  449.  
  450. ANSWER: To paste link the embedded chart into Word for Windows, do the
  451. following:
  452.  
  453. 1. Double-click the chart to open it in its own window.
  454.  
  455. 2. From the Chart menu, choose Select Chart.
  456.  
  457. 3. Hold down the SHIFT key and choose Copy Picture from the Edit menu.
  458.    Select the desired options.
  459.  
  460. 4. Activate the Word for Windows document, and choose Paste Link from
  461.    the Edit menu.
  462.  
  463. If the chart has its own chart file, follow steps 2 through 4 above.
  464.  
  465. For more information on linking documents from Microsoft Excel into
  466. other applications, see pages 316-319 of the "Microsoft Excel User's
  467. Guide."
  468.  
  469.                                    
  470.                   USING EXCEL'S STATISTICAL FUNCTIONS
  471.                   ===================================
  472.  
  473. ----------------------------------------------------------------------
  474. QUESTION: How can I return the additional regression statistics that
  475.           are built into the LINEST function?
  476.  
  477. ANSWER: The Excel 3.0 LINEST function returns several additional
  478. statistics that were not available with earlier versions of Excel. To
  479. retrieve these statistics, you must first select an appropriately
  480. sized array on your worksheet. The array should be five rows high and
  481. two columns wide. If your original data includes more than one x-
  482. variable, your array should include one extra column for each
  483. additional x-variable. For example, if you have three x-variables,
  484. your array will be five rows by four columns.
  485.  
  486. The syntax of the LINEST function is:
  487.  
  488.    =LINEST(<known_y's>,<known_x's>,<const>,<stats>)
  489.  
  490. By setting the <stats> argument to TRUE, you instruct Excel to return
  491. the additional statistics. If <stats> is set to FALSE, the LINEST
  492. function will return only the slope and the y-intercept. (See pages
  493. 138-141 of the "Microsoft Excel Function Reference" for a complete
  494. discussion of the <known_y's>, <known_x's>, and <const> arguments.)
  495.  
  496. Example
  497. -------
  498.  
  499.        A        B         C
  500.    1 Known-Y's XVar1     XVar2
  501.    2 200       15        76
  502.    3 210       20        65
  503.    4 195       23        66
  504.    5 235       28        72
  505.    6 250       36        80
  506.  
  507. The data in the example shown above includes two x-variables, so the
  508. array that must be selected to return the LINEST statistics will be
  509. five rows by three columns. After typing in the formula, you must
  510. press CTRL+SHIFT+ENTER. This enters the formula as an array formula,
  511. and you will see braces ({}) placed around the formula in the formula
  512. bar. The additional statistics are returned in the last three rows and
  513. first two columns of your array. If your array has more than the
  514. required number of columns (two), #N/A errors will be returned in the
  515. extra columns.
  516.  
  517. Select cells E2:G6 and enter the following:
  518.    
  519.    =LINEST(A2:A6,B2:C6,,TRUE)
  520.  
  521. For this example, omit the third argument. The results are returned as
  522. follows:
  523.  
  524.          E         F         G
  525.    2  1.017709   2.22756  90.57607
  526.    3  1.167926  0.934885  76.37852
  527.    4  0.840776   13.3242      #N/A
  528.    5  5.280472         2      #N/A
  529.    6  1874.931  355.0688      #N/A
  530.  
  531. Cells E3:F6 contain the additional regression statistics.
  532.  
  533.  
  534. ----------------------------------------------------------------------
  535. QUESTION: How can I retrieve the correlation coefficient and/or the
  536.           coefficient of determination?
  537.  
  538. ANSWER: The Excel 3.0 LINEST function automatically returns the
  539. coefficient of determination (r-squared). The correlation coefficient
  540. is the square root (r) of this value.
  541.  
  542. To retrieve the coefficient of determination, use the method shown in
  543. the above example. The r-squared value is found in the third row,
  544. first column (cell E4) of the resulting array. To find the correlation
  545. coefficient, take the square root of this value.
  546.  
  547. To retrieve these values without returning all the other statistics,
  548. use the following formulas:
  549.  
  550. Coefficient of Determination:
  551.  
  552.   =INDEX(LINEST(<known_y's>,<known_x's>,<const>,TRUE),3,1)
  553.  
  554. Using the example above, this is:
  555.  
  556.   =INDEX(LINEST(A2:A6,B2:C6,,TRUE),3,1)
  557.  
  558. Correlation Coefficient:
  559.  
  560.   =SQRT(INDEX(LINEST(<known_y's>,<known_x's>,<const>,TRUE),3,1))
  561.  
  562. Using the example above, this is:
  563.  
  564.    =SQRT(INDEX(LINEST(A2:A6,B2:C6,,TRUE),3,1))
  565.  
  566. Be sure to enter these formulas as array formulas by pressing
  567. CTRL+SHIFT+ENTER.
  568.  
  569. For more information on Excel's LINEST function, see pages 138-141 of
  570. the "Microsoft Excel Function Reference."
  571.  
  572.                                    
  573.                            AUTO_OPEN MACROS
  574.                            ================
  575.  
  576. ----------------------------------------------------------------------
  577. QUESTION: How do I set up a macro so that it runs every time I open a
  578.           document?
  579.  
  580. ANSWER: To have a macro run automatically every time a document is
  581. opened, do the following:
  582.  
  583. 1. Open the document (this can be either a worksheet or a macro
  584.    sheet).
  585.  
  586. 2. From the Formula menu, choose Define Name.
  587.  
  588. 3. In the Name box, type a name that starts with Auto_Open (for
  589.    example, Auto_Open_1, Auto_Open_Menu).
  590.  
  591. 4. In the Refers To box, type the name or reference of the macro you
  592.    want to run. If you enter an external reference, Excel opens the
  593.    macro sheet (if it is not already open) before running the macro.
  594.  
  595. Example
  596. -------
  597.  
  598. The following steps will allow the macro defined as TEST on MACRO1.XLM
  599. to automatically run every time SHEET1.XLS is opened:
  600.  
  601. 1. Make sure TEST is working properly before defining it to run
  602.    automatically.
  603.  
  604. 2. Activate SHEET1.XLS and choose Define Name from the Formula menu.
  605.    In the Name box, type "Auto_Open" (without the quotation marks).
  606.  
  607. 3. In the Refers To box, type "MACRO1.XLM!TEST" (without the quotation
  608.    marks).
  609.  
  610. 4. Choose the OK button and save SHEET1.XLS.
  611.  
  612. The next time SHEET1.XLS is opened, MACRO1.XLM will load and the macro
  613. TEST will run.
  614.  
  615. For more information, see page 622 of the "Microsoft Excel User's
  616. Guide."
  617.  
  618.                                    
  619.                      EDITING AN EXCEL CHART SERIES
  620.                      =============================
  621.  
  622. ----------------------------------------------------------------------
  623. QUESTION: How can I update my chart when I add additional data to the
  624.           spreadsheet without re-creating the chart?
  625.  
  626. ANSWER: To update the chart when you add additional data to a series,
  627. you will need to modify the chart Series formula. There are two
  628. methods to accomplish this:
  629.  
  630. Method 1
  631. --------
  632.  
  633. 1. Activate the chart you want to update.
  634. 2. From the Chart menu, choose Edit Series.
  635. 3. From the Series box, select the name of the series you want to
  636.    update.
  637. 4. Update the references in the X Labels and Y Values boxes to include
  638.    the new data points that were added to the worksheet.
  639.  
  640. Method 2
  641. --------
  642.  
  643. 1. Activate the chart you want to update.
  644. 2. Select the series you want to update.
  645. 3. Edit the series formula in the formula bar to reflect the new data
  646.    points on the worksheet.
  647.  
  648. If you want to add an additional series to the chart, rather than
  649. modify an existing one, do one of the following:
  650.  
  651. Method 1
  652. --------
  653.  
  654. 1. Activate the chart you want to update.
  655. 2. From the Chart menu, choose Edit Series.
  656. 3. From the Series box, select New Series.
  657. 4. Update the references in the X Labels and Y Values boxes to include
  658.    the new column or row of data that defines your new series.
  659.  
  660. Method 2
  661. --------
  662.  
  663. 1. Highlight the data for the new series on the worksheet.
  664. 2. From the Edit menu, choose Copy.
  665. 3. Activate the chart you want to update.
  666. 4. From the Edit menu, choose Paste.
  667.  
  668. For more information on editing a Series formula, see page 422 of the
  669. "Microsoft Excel User's Guide."
  670.  
  671.   Note: In all the methods described above, defined names for the cell
  672.   ranges may be substituted for the actual cell references. This
  673.   option enables the chart to be updated by redefining the range name
  674.   on the worksheet to include the new data.
  675.  
  676. For more information on naming a cell or range of cells on a
  677. worksheet, see page 224 of the "Microsoft Excel User's Guide."
  678.